using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Silvery;

namespace Sample01_Base
{
    //最基本的屏Screen，每个对象最终会呈现在一个Screen上通过添加
    //Screen继承带有一些基本的属性，例如带位置信息，自身循环逻辑等
    public class Sample_1 : NScreen
    {
        NImageM testobj = new NImageM();
        public Sample_1()
        {
            //开启自身循环
            this.IsSelfLoopRun = true;
            
            testobj.LoadImage(new Uri("Res/nowpaper.jpg", UriKind.Relative));
            testobj.OffsetPoint = new Point(-60, -120);
            testobj.Position = new Point(100, 200);
            this.AddBaseObj(testobj);
        }
        //速度
        double speed = 2;
        public override void OnUpdata(BaseObject sender, ITimer timer)
        {
            if (testobj.Position.X >= 500)
                testobj.Position = new Point(100, testobj.Position.Y);
            else
                testobj.Position = new Point(testobj.Position.X + speed, testobj.Position.Y);
            base.OnUpdata(sender, timer);
        }
    }
}
